package com.yinxin.reflection.InvocationProxy.Jdk;

/**
 * @author yinxin
 * @version 1.0
 * @Description:
 * @date 2022/8/1816:35
 */
public class MybatisApplication {
    public static void main(String[] args) {
        UserDaoImpl userDao = new UserDaoImpl();
        UserDao proxy= (UserDao) new JDKProxy(userDao).createProxy();
        proxy.getMoney();
        /*
        * jdk代理类需要有接口才能实现动态代理
        * */
    }
    /*public static void main(String[] args) {
        UserController userController = new UserController();
        UserController UserProxy = (UserController) new JDKProxy(userController).createProxy();
        UserProxy.say();
        *//*报错:
         com.sun.proxy.$Proxy0 cannot be cast to com.yinxin.reflection.InvocationProxy.Jdk.UserController
        	at com.yinxin.reflection.InvocationProxy.Jdk.MybatisApplication.main(MybatisApplication.java:17)*//*
    }*/
}
